package com.heart.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.heart.dao.entity.Question;
import com.heart.dao.entity.QuestionDetail;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

public interface QuestionService extends IService<Question> {
    /**
     * 获取首页问卷、登录人次、答卷的数量
     * @param type
     * @return
     */
    Integer getDashboardNumber(String type);

    /**
     * 获取首页最近7天数量
     * @return
     */
    Map<String,Map<String,List<Integer>>> getDashboardListNumber();

    /**
     * 根据用户查询问卷列表
     * @param userCode
     * @return
     */
    List<Question> getQuestionListByUserCode(String userCode);

    /**
     * 根据问卷id查询问卷明细
     * @param questionId
     * @return
     */
    List<QuestionDetail> getQuestionDetailListByQuestionId(String questionId);

    /**
     * 更新问卷题
     * @param question
     * @return
     */
    boolean updateQuestion(Question question);

    /**
     * 更新问卷设置
     * @param question
     * @return
     */
    boolean updateQuestionSetting(Question question);

    /**
     * 发布问卷
     * @param question
     * @return
     */
    boolean publishQuestion(Question question);

    /**
     * 软删除问卷
     * @param question
     * @return
     */
    boolean deleteQuestion(Question question);

    /**
     * 彻底删除
     * @param question
     * @return
     */
    boolean completeDeleteQuestion(Question question);

    /**
     * 保存问卷
     * @param question
     * @return
     */
    boolean saveQuestion(Question question);

    /**
     * 复制问卷
     * @param question
     * @return
     */
    boolean copyQuestion(Question question);

    /**
     * 根据问卷id展示所有的问卷题
     * @param questionId
     * @return
     */
    Question getQuestionAndDetailById(Integer questionId);

    /**
     * 根据问卷ID获取当前问卷
     * @param questionId
     * @return
     */
    Question getQuestionById(Integer questionId);

    /**
     * 校验用户提交问卷的限制
     * @param questionId
     * @return
     */
    boolean validateQuestionLimit(HttpServletRequest request, String questionId);
}
